﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lincolnwood.Foundation.SermonLibrary
{
    [Serializable]
    public class ScriptureReference
    {
        private short _bookNumber;
        private string _bookName;
        private string _bookShortName;
        private short _chapter;
        private short _verseBegin;
        private short _verseEnd;

        internal ScriptureReference()
        { }

        internal ScriptureReference(short bookNumber, string bookName, string shortBookName)
        {
            _bookNumber = bookNumber;
            _bookName = bookName;
            _bookShortName = shortBookName;
        }

        internal ScriptureReference(short bookNumber, string bookName, string shortBookName, short chapter)
        {
            _bookNumber = bookNumber;
            _bookName = bookName;
            _bookShortName = shortBookName;
            _chapter = chapter;
        }

        internal ScriptureReference(short bookNumber, string bookName, string shortBookName, short chapter, short verse)
        {
            _bookNumber = bookNumber;
            _bookName = bookName;
            _bookShortName = shortBookName;
            _chapter = chapter;
            _verseBegin = verse;
            _verseEnd = verse;
        }

        internal ScriptureReference(short bookNumber, string bookName, string shortBookName, short chapter, short verseBegin, short verseEnd)
        {
            _bookNumber = bookNumber;
            _bookName = bookName;
            _bookShortName = shortBookName;
            _chapter = chapter;
            _verseBegin = verseBegin;
            _verseEnd = verseEnd;
        }

        public short BookNumber
        {
            get { return _bookNumber; }
        }

        public string BookName
        {
            get { return _bookName; }
        }

        public string BookShortName
        {
            get { return _bookShortName; }
        }

        public short Chapter
        {
            get { return _chapter; }
        }

        public short VerseBegin
        {
            get { return _verseBegin; }
        }

        public short VerseEnd
        {
            get { return _verseEnd; }
        }

        public override bool Equals(object obj)
        {
            var testScriptureReference = obj as ScriptureReference;
            if (testScriptureReference == null)
                return false;
            else
                return Equals(testScriptureReference);
        }

        private bool Equals(ScriptureReference arg)
        {
            return 
            BookNumber.Equals(arg.BookNumber) &&
            BookName.Equals(arg.BookName) &&
            BookShortName.Equals(arg.BookShortName) &&
            Chapter.Equals(arg.Chapter) &&
            VerseBegin.Equals(arg.VerseBegin) &&
            VerseEnd.Equals(arg.VerseEnd);
        }
    }
}